package cn.qiao.benchmark;

import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;

/**
 * desc:
 *
 * @author qiao
 * @date 2024年03月07日 22:34
 */
public class LettuceImpl implements RedisService {

    private RedisClient redisClient;

    private StatefulRedisConnection<String, String> connect;





    public LettuceImpl(RedisClient redisClient) {
        this.connect = redisClient.connect();
        this.redisClient = redisClient;
    }

    @Override
    public void set(String key, String value) {
        RedisCommands<String, String> sync = connect.sync();
        sync.set(key,value);
    }

    @Override
    public String get(String key) {
        RedisCommands<String, String> sync = connect.sync();
        return sync.get(key);
    }
}
